<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Filesystem utilities</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GTK+ 3 参考手册">
<link rel="up" href="gtkbase.html" title="Part II. GTK+核心参考">
<link rel="prev" href="gtk3-Testing.html" title="Testing">
<link rel="next" href="theming.html" title="Part III. GTK+中的主题">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gtk3-Testing.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="gtkbase.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GTK+ 3 参考手册</th>
<td><a accesskey="n" href="theming.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gtk3-Filesystem-utilities.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gtk3-Filesystem-utilities.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gtk3-Filesystem-utilities"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gtk3-Filesystem-utilities.top_of_page"></a>Filesystem utilities</span></h2>
<p>Filesystem utilities — Functions for working with GIO</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gtk3-Filesystem-utilities.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gtk/gtk.h&gt;

struct              <a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation">GtkMountOperation</a>;
<a href="../gio/GMountOperation.html"><span class="returnvalue">GMountOperation</span></a> *   <a class="link" href="gtk3-Filesystem-utilities.html#gtk-mount-operation-new" title="gtk_mount_operation_new ()">gtk_mount_operation_new</a>             (<em class="parameter"><code><a class="link" href="gtk3-GtkWindow.html#GtkWindow" title="GtkWindow"><span class="type">GtkWindow</span></a> *parent</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gtk3-Filesystem-utilities.html#gtk-mount-operation-is-showing" title="gtk_mount_operation_is_showing ()">gtk_mount_operation_is_showing</a>      (<em class="parameter"><code><a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> *op</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-Filesystem-utilities.html#gtk-mount-operation-set-parent" title="gtk_mount_operation_set_parent ()">gtk_mount_operation_set_parent</a>      (<em class="parameter"><code><a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> *op</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gtk3-GtkWindow.html#GtkWindow" title="GtkWindow"><span class="type">GtkWindow</span></a> *parent</code></em>);
<a class="link" href="gtk3-GtkWindow.html#GtkWindow" title="GtkWindow"><span class="returnvalue">GtkWindow</span></a> *         <a class="link" href="gtk3-Filesystem-utilities.html#gtk-mount-operation-get-parent" title="gtk_mount_operation_get_parent ()">gtk_mount_operation_get_parent</a>      (<em class="parameter"><code><a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> *op</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-Filesystem-utilities.html#gtk-mount-operation-set-screen" title="gtk_mount_operation_set_screen ()">gtk_mount_operation_set_screen</a>      (<em class="parameter"><code><a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> *op</code></em>,
                                                         <em class="parameter"><code><a href="../gdk3/GdkScreen.html"><span class="type">GdkScreen</span></a> *screen</code></em>);
<a href="../gdk3/GdkScreen.html"><span class="returnvalue">GdkScreen</span></a> *         <a class="link" href="gtk3-Filesystem-utilities.html#gtk-mount-operation-get-screen" title="gtk_mount_operation_get_screen ()">gtk_mount_operation_get_screen</a>      (<em class="parameter"><code><a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> *op</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gtk3-Filesystem-utilities.html#gtk-show-uri" title="gtk_show_uri ()">gtk_show_uri</a>                        (<em class="parameter"><code><a href="../gdk3/GdkScreen.html"><span class="type">GdkScreen</span></a> *screen</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *uri</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> timestamp</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gtk3-Filesystem-utilities.description"></a><h2>Description</h2>
<p>
The functions and objects described here make working with GTK+ and
GIO more convenient.
</p>
<p>
<a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> is needed when mounting volumes:
It is an implementation of <a href="../gio/GMountOperation.html"><span class="type">GMountOperation</span></a> that can be used with
GIO functions for mounting volumes such as
<a href="../gio/GFile.html#g-file-mount-enclosing-volume"><code class="function">g_file_mount_enclosing_volume()</code></a>, <a href="../gio/GFile.html#g-file-mount-mountable"><code class="function">g_file_mount_mountable()</code></a>,
<a href="../gio/GVolume.html#g-volume-mount"><code class="function">g_volume_mount()</code></a>, <a href="../gio/GMount.html#g-mount-unmount-with-operation"><code class="function">g_mount_unmount_with_operation()</code></a> and others.
</p>
<p>
When necessary, <a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> shows dialogs to ask for
passwords, questions or show processes blocking unmount.
</p>
<p>
<a class="link" href="gtk3-Filesystem-utilities.html#gtk-show-uri" title="gtk_show_uri ()"><code class="function">gtk_show_uri()</code></a> is a convenient way to launch applications for URIs.
</p>
<p>
Another object that is worth mentioning in this context is
<a href="../gdk3/gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a>, which provides visual feedback when lauching
applications.
</p>
</div>
<div class="refsect1">
<a name="gtk3-Filesystem-utilities.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GtkMountOperation"></a><h3>struct GtkMountOperation</h3>
<pre class="programlisting">struct GtkMountOperation {
  GMountOperation parent_instance;

  GtkMountOperationPrivate *priv;
};
</pre>
<p>
This should not be accessed directly. Use the accessor functions below.
</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-mount-operation-new"></a><h3>gtk_mount_operation_new ()</h3>
<pre class="programlisting"><a href="../gio/GMountOperation.html"><span class="returnvalue">GMountOperation</span></a> *   gtk_mount_operation_new             (<em class="parameter"><code><a class="link" href="gtk3-GtkWindow.html#GtkWindow" title="GtkWindow"><span class="type">GtkWindow</span></a> *parent</code></em>);</pre>
<p>
Creates a new <a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td>
<td>transient parent of the window, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a new <a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-mount-operation-is-showing"></a><h3>gtk_mount_operation_is_showing ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gtk_mount_operation_is_showing      (<em class="parameter"><code><a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> *op</code></em>);</pre>
<p>
Returns whether the <a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> is currently displaying
a window.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>op</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>op</code></em> is currently displaying a window</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-mount-operation-set-parent"></a><h3>gtk_mount_operation_set_parent ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_mount_operation_set_parent      (<em class="parameter"><code><a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> *op</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gtk3-GtkWindow.html#GtkWindow" title="GtkWindow"><span class="type">GtkWindow</span></a> *parent</code></em>);</pre>
<p>
Sets the transient parent for windows shown by the
<a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>op</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td>
<td>transient parent of the window, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-mount-operation-get-parent"></a><h3>gtk_mount_operation_get_parent ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWindow.html#GtkWindow" title="GtkWindow"><span class="returnvalue">GtkWindow</span></a> *         gtk_mount_operation_get_parent      (<em class="parameter"><code><a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> *op</code></em>);</pre>
<p>
Gets the transient parent used by the <a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>op</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the transient parent for windows shown by <em class="parameter"><code>op</code></em>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-mount-operation-set-screen"></a><h3>gtk_mount_operation_set_screen ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_mount_operation_set_screen      (<em class="parameter"><code><a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> *op</code></em>,
                                                         <em class="parameter"><code><a href="../gdk3/GdkScreen.html"><span class="type">GdkScreen</span></a> *screen</code></em>);</pre>
<p>
Sets the screen to show windows of the <a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> on.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>op</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>screen</code></em> :</span></p></td>
<td>a <a href="../gdk3/GdkScreen.html"><span class="type">GdkScreen</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-mount-operation-get-screen"></a><h3>gtk_mount_operation_get_screen ()</h3>
<pre class="programlisting"><a href="../gdk3/GdkScreen.html"><span class="returnvalue">GdkScreen</span></a> *         gtk_mount_operation_get_screen      (<em class="parameter"><code><a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a> *op</code></em>);</pre>
<p>
Gets the screen on which windows of the <a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a>
will be shown.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>op</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-Filesystem-utilities.html#GtkMountOperation" title="struct GtkMountOperation"><span class="type">GtkMountOperation</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the screen on which windows of <em class="parameter"><code>op</code></em> are shown. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-show-uri"></a><h3>gtk_show_uri ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gtk_show_uri                        (<em class="parameter"><code><a href="../gdk3/GdkScreen.html"><span class="type">GdkScreen</span></a> *screen</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *uri</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> timestamp</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
This is a convenience function for launching the default application
to show the uri. The uri must be of a form understood by GIO (i.e. you
need to install gvfs to get support for uri schemes such as http://
or ftp://, as only local files are handled by GIO itself).
Typical examples are
</p>
<table border="0" summary="Simple list" class="simplelist">
<tr><td><code class="filename">file:///home/gnome/pict.jpg</code></td></tr>
<tr><td><code class="filename">http://www.gnome.org</code></td></tr>
<tr><td><code class="filename">mailto:me@gnome.org</code></td></tr>
</table>
<p>
Ideally the timestamp is taken from the event triggering
the <a class="link" href="gtk3-Filesystem-utilities.html#gtk-show-uri" title="gtk_show_uri ()"><code class="function">gtk_show_uri()</code></a> call. If timestamp is not known you can take
<a href="../gdk3/gdk3-Events.html#GDK-CURRENT-TIME:CAPS"><code class="literal">GDK_CURRENT_TIME</code></a>.
</p>
<p>
This function can be used as a replacement for <a href="../gnome-vfs-2.0/gnome-vfs-2.0-gnome-vfs-utils.html#gnome-vfs-url-show"><code class="function">gnome_vfs_url_show()</code></a>
and <a href="../libgnome/libgnome-gnome-url.html#gnome-url-show"><code class="function">gnome_url_show()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>screen</code></em> :</span></p></td>
<td>screen to show the uri on
or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for the default screen. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>uri</code></em> :</span></p></td>
<td>the uri to show</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>timestamp</code></em> :</span></p></td>
<td>a timestamp to prevent focus stealing</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>a <a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> that is returned in case of errors</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on error</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>